package cn.bigcontainer.alt.sys.controller;

import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.SessionAttributes;

import cn.bigcontainer.alt.common.exception.BigResultCode;
import cn.bigcontainer.alt.common.util.WoKit;
import cn.bigcontainer.alt.sys.service.SysMenuService;
import cn.bigcontainer.alt.sys.util.SysConstant;

/**
 * 菜单的Controller类，用于处理用户请求.
 *
 * @author jiaod
 * @date 2020-04-13
 */
@Controller
@SessionAttributes(SysConstant.SESSION_USER)
@RequestMapping("/sys/menu")
public class SysMenuController {

	@Resource
	private SysMenuService sysMenuService;
	
	@RequestMapping("/move")
	@ResponseBody
	public BigResultCode move (Integer selectedIds, @RequestParam Map<String, Object> req, Map<String, Object> map) {
		sysMenuService.move (selectedIds, WoKit.getInt(req.get("offset"), -1));
		return BigResultCode.getSuccessCode();
	}
}
